package org.example.ch04;

/**
 * @author yang
 * @date 2024-03-20
 */
public class MyThread extends Thread{
    @Override
    public void run() {
        while (true){
            boolean status = Thread.currentThread().isInterrupted();
            if (status){
                System.out.println("数据采集完毕");
                break;
            }
            System.out.println("采集数据...");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        }
    }
}
